1 using System;
2 using
System.Collections.Generic;
3 using
System.ComponentModel;
4 using
System.Drawing;
5 using
System.Data;
6 using
System.Linq;
7 using
System.Text;
8 using
System.Threading.Tasks;
9 using
System.Windows.Forms;
10 using
System.Data.SqlClient;
11
12 namespace
SoftQuanLyNhaHang.Models
13 {
14     
class BomMod
15     {
16         
protected int IdBom { get; set; }
17         
protected string TieuDe { get; set; }
18         
protected float SoLuong { get; set; }
19         
protected DateTime NgayBatDau { get; set; }
20         
protected DateTime NgayKetThuc { get; set; }
21         
protected double GiaVon { get; set; }
22         
protected double GiaBan { get; set; }
23         
protected string TrangThai { get; set; }
24         
protected string MoTa { get; set; }
25         
protected DateTime NgayTao { get; set; }
26         
protected DateTime NgayHomNay { get; set; }
27
28         
protected int PageSize { get; set; }
29         
protected int PageIndex { get; set; }
30
31         
public BomMod(int _IdBom)
32         {
33             IdBom = _IdBom;
34         }
35         
public BomMod()
36         { }
37
38
39         
public BomMod(int _IdBom ,string _TieuDe, float _SoLuong, DateTime _NgayBatDau, DateTime _NgayKetThuc, double _GiaVon, double _GiaBan, string _TrangThai, string _MoTa, DateTime _NgayTao)
40         {
41              IdBom = _IdBom;
42              TieuDe = _TieuDe;
43              SoLuong = _SoLuong ;
44              NgayBatDau = _NgayBatDau;
45              NgayKetThuc = _NgayKetThuc;
46              GiaVon = _GiaVon;
47              GiaBan = _GiaBan;
48              TrangThai = _TrangThai ;
49              MoTa = _MoTa;
50              NgayTao = _NgayTao;
51         }
52
53         
public BomMod(int _IdBom, string _TieuDe, float _SoLuong, DateTime _NgayBatDau, DateTime _NgayKetThuc, double _GiaVon, double _GiaBan, string _TrangThai, string _MoTa, int _PageSize, int _PageIndex, DateTime _NgayHomNay)
54         {
55             IdBom = _IdBom;
56             TieuDe = _TieuDe;
57             SoLuong = _SoLuong;
58             NgayBatDau = _NgayBatDau;
59             NgayKetThuc = _NgayKetThuc;
60             GiaVon = _GiaVon;
61             GiaBan = _GiaBan;
62             TrangThai = _TrangThai;
63             MoTa = _MoTa;
64             PageSize = _PageSize;
65             PageIndex = _PageIndex;
66             NgayHomNay = _NgayHomNay;
67         }
68
69         
public int InsertBom()
70         {
71             
int i = 0;
72             
string[] paras = new string[10] { "@IdBom", "@TieuDe", "@SoLuong", "@NgayBatDau", "@NgayKetThuc", "@GiaVon", "@GiaBan", "@TrangThai", "@MoTa", "@NgayTao" };
73             
object[] values = new object[10] { IdBom, TieuDe, SoLuong, NgayBatDau, NgayKetThuc, GiaVon, GiaBan, TrangThai, MoTa, NgayTao };
74             i = Int32.Parse(Models.connection.ExcuteScalar(
"tbl_Bom_Insert", CommandType.StoredProcedure, paras, values));
75             
return i;
76         }
77
78         
public int UpdateBom()
79         {
80             
int i = 0;
81             
string[] paras = new string[10] { "@IdBom", "@TieuDe", "@SoLuong", "@NgayBatDau", "@NgayKetThuc", "@GiaVon", "@GiaBan", "@TrangThai", "@MoTa" ,"@NgayTao"};
82             
object[] values = new object[10] { IdBom, TieuDe, SoLuong, NgayBatDau, NgayKetThuc, GiaVon, GiaBan, TrangThai, MoTa , NgayTao};
83             i = Models.connection.Excute_Sql(
"tbl_Bom_Update", CommandType.StoredProcedure, paras, values);
84             
return i;
85         }
86
87         
public int DeleteBom()
88         {
89             
int i = 0;
90             
string[] paras = new string[1] { "@IdBom" };
91             
object[] values = new object[1] { IdBom };
92             i = Models.connection.Excute_Sql(
"tbl_Bom_Delete", CommandType.StoredProcedure, paras, values);
93             
return i;
94         }
95
96         
//lay ra danh sach bom
97         
public DataSet FillDataSet_getBom_Search()
98         {
99             DataSet ds =
new DataSet();
100             
string[] paras = new string[12] { "@IdBom", "@TieuDe", "@SoLuong", "@NgayBatDau", "@NgayKetThuc", "@GiaVon", "@GiaBan", "@TrangThai", "@MoTa", "@PageSize", "@PageIndex" ,"@NgayHomNay" };
101             
object[] values = new object[12] { IdBom, TieuDe, SoLuong, NgayBatDau, NgayKetThuc, GiaVon, GiaBan, TrangThai, MoTa, PageSize, PageIndex, NgayHomNay };
102             ds = Models.connection.FillDataSet(
"tbl_Bom_Search", CommandType.StoredProcedure, paras, values);
103             
return ds;
104         }
105
106         
//lay 1 bom by id
107         
public DataSet FillDataSet_getBom_ByIdBom()
108         {
109             DataSet ds =
new DataSet();
110             
string[] paras = new string[1] { "@IdBom"};
111             
object[] values = new object[1] { IdBom};
112             ds = Models.connection.FillDataSet(
"tbl_Bom_Get", CommandType.StoredProcedure, paras, values);
113             
return ds;
114         }
115     }
116 }


Gõ tìm kiếm nhanh...